package com.itheima.daiotuwang.service.imp;

import com.itheima.daiotuwang.mapper.UserMapper;
import com.itheima.daiotuwang.pojo.User;
import com.itheima.daiotuwang.service.UserService;
import com.itheima.daiotuwang.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImp implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findByUserName(String username) {
        User u = userMapper.findByUserName(username);
        return  u ;

    }

    @Override
    public void register(String username, String password) {

        //加密
        String md5String =  Md5Util.getMD5String(password);
        //添加
        userMapper.add(username,md5String);
    }

}
